package start;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
public class Magician2 implements MindReader {
    private Integer integer;
    private String thoughts;
    
    @Pointcut("execution (* start.Thinker.thinkOfSomething(String,Integer)) && args(thoughts,integer)")
    public void thinking(Integer integer, String thoughts) {}
    
    public Magician2() {
        System.out.println("Magician2 create..");
    }

    @Override
    @Before("thinking(integer,thoughts)")
    public void interceptThoughts(Integer integer, String thoughts) {
        System.out.println("Magician2 interceptThoughts()..");
        this.thoughts = thoughts;
        this.integer = integer;
    }

    @Override
    public String getThoughts() {
        return thoughts;
    }

    @Override
    public Integer getInteger() {
        return integer;
    }
}
